//
//  LGDiseaseOverviewItemCell.m
//  HeartDiseaseManage
//
//  Created by 1234 on 2023/10/13.
//  病情概览 - 顶部item

#import "LGDiseaseOverviewItemCell.h"

@interface LGDiseaseOverviewItemCell()
/**   */
@property (nonatomic , strong)UILabel *titleLabel;
/**   */
@property (nonatomic , strong)UIView *lineView;

@end

@implementation LGDiseaseOverviewItemCell

- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        self.contentView.backgroundColor = [UIColor clearColor];
        [self.contentView addSubview:self.titleLabel];
        [self.contentView addSubview:self.lineView];
        [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.centerY.equalTo(self.contentView);
        }];
        [self.lineView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.equalTo(self.contentView);
            make.bottom.equalTo(self.contentView);
            make.width.equalTo(@(viewPix(13)));
            make.height.equalTo(@(3));
        }];
    }
    return self;
}

-(void)setContent:(NSString *)content{
    _content = content;
    self.titleLabel.text = content;
}

-(void)setIsSelected:(BOOL)isSelected{
    _isSelected = isSelected;
    self.lineView.hidden = !isSelected;
    NSString *colorName = (isSelected == YES)?@"#4C87FD":@"#666666";
    UIFont *font = (isSelected == YES)?LGFontWeight(15, UIFontWeightMedium):LGFont(14);
    self.titleLabel.textColor = [UIColor colorWithString:colorName];
    self.titleLabel.font = font;
}

-(UILabel *)titleLabel{
    if(!_titleLabel){
        _titleLabel = [UILabel lableWithText:@"" colorString:@"#666666" textFont:LGFont(14) textAlignment:NSTextAlignmentCenter lines:1];
    }
    return _titleLabel;
}

-(UIView *)lineView{
    if(!_lineView){
        _lineView = [[UIView alloc] init];
        _lineView.backgroundColor = [UIColor colorWithString:@"#3291FF"];
        _lineView.cornerRidus = 1.5;
        _lineView.hidden = YES;
    }
    return _lineView;
}

@end
